<div style="float:left;margin-left:300px"  style="display: none;">
						
<form method="post" action="__CONTROLLER__/importexl" enctype="multipart/form-data">
 导入Excel表：<input type="file" name="file_stu" />

  <input type="submit" value="导入" />
</form>
					</div>

<div class="filter-bar">

	<form action="__CONTROLLER__/index" method="post" >
		<div class="view">
			<div class="row clearfix">
				<div class="col-md-4 column row ui-sortable">
				    <label class="col-sm-4 control-label" style="margin-top: 8px;">订单编号</label>
				    <div class="col-sm-8">
				   		<input type="text" name="orderId" class="form-control" value="{$params.orderId}"/>
				    </div>
				</div>	
				<div class="col-md-4 column row ui-sortable">
				    <label class="col-sm-3 control-label" style="margin-top: 8px;">订单属于</label>
				    <div class="col-sm-9">
					      <select class="form-control" style="float: left;"  name="agentId">
			              {$belongsOptions}
			              </select>
				    </div>
				</div>
				<div class="col-md-4 column row ui-sortable">
				    <label class="col-sm-3 control-label" style="margin-top: 8px;">订单类型</label>
				    <div class="col-sm-9">
					      <select class="form-control" style="float: left;margin-right: 10px;"  name="type">
			              {$orderTypesOptions}
			              </select>
				    </div>
				</div>
			</div>
			<div class="row clearfix" style="margin-top:10px;">
				<div class="col-md-4 column row ui-sortable">
				    <label class="col-sm-4 control-label" style="margin-top: 8px;">OpenId</label>
				    <div class="col-sm-8">
				   		<input type="text" name="openId" class="form-control" value="{$params.openId}"/>
				    </div>
				</div>
				<div class="col-md-4 column row ui-sortable">
				    <label class="col-sm-3 control-label" style="margin-top: 8px;">收货人</label>
				    <div class="col-sm-9">
				   		<input type="text" name="consignee" class="form-control" value="{$params.consignee}"/>
				    </div>
				</div>	
				<div class="col-md-4 column row ui-sortable">
				    <label class="col-sm-3 control-label" style="margin-top: 8px;">收货人电话</label>
				    <div class="col-sm-9">
				   		<input type="text" name="tel" class="form-control" value="{$params.tel}"/>
				    </div>
				</div>	
			</div>
			<div class="row clearfix" style="margin-top:10px;">
				<div class="col-md-5 column row ui-sortable">
				    <label class="col-sm-3 control-label" style="margin-top: 8px;">订单时间</label>
				    <div class="col-sm-3" style="padding-right:0px">
					      <select class="form-control" style="float: left;"  name="timeType">
			              {$timeTypeOptions}
			              </select>
				    </div>
					<div class="col-sm-3" style="padding-right:0px">
						<div id="reportrange" class="pull-right" style="background: #fff; cursor: pointer; padding: 5px 10px; border: 1px solid #ccc">
			               <i class="glyphicon glyphicon-calendar fa fa-calendar"></i>
			               <span></span> <b class="caret"></b>
			               <input type="hidden" name="startDate" value="{$params.startDate}"/><input type="hidden" name="endDate" value="{$params.endDate}"/>
			            </div>
					</div>
				</div>
			</div>
			<div class="row clearfix" style="margin-top:10px;">
				<div class="column row ui-sortable">
					
				    <div style="float:right;margin-right:120px">
			              <input type="submit"  class="btn btn-primary" value="搜索">
						  <div class='btn-group'>
					
						
							<input id="btnExportExcel" data-url="{:U('DistributionShopOrder/exportOrderXLS')}" data-details-url="{:U('DistributionShopOrder/exportXLS')}" type="button" class="btn btn-info" value="导出Excel"/>
							<a class='btn btn-info dropdown-toggle' data-toggle='dropdown' href='javascript:;'><span class='caret'></span></a>
							<ul class='dropdown-menu' role="menu">
								<li style="padding-left: 12px;">
								   <div class="checkbox">
								      <label><input id="btn-xls-details" name="{$params.exportDetail}" type="checkbox" {$params['exportDetail']?'checked="checked"':''}>导出详细</label>
								  </div>
								</li>
							</ul>
						  </div>
				    </div>
				</div>	
			</div>
		</div>
	</form>
</div>
<hr/>
<table class="table table-hover">
 <thead>
  <tr>
   <th>ID</th>
   <th>订单编号</th>
   <th>微信用户/OpenId</th>
   <th>收货人</th>
   <th>收货人电话</th>
   <th>下单时间</th>
   <th>支付时间</th>
   <th>订单状态</th>
   <th>操作</th>
  </tr>
 </thead>
 <tbody>
  <volist name="productOrderLists" id="vo">
   <tr>
    <td>{$vo.id}</td>
    <td>{$vo.order_id}</td>
    <td>{$vo.nickname}<br/>{$vo.openId}<br/></td>
    <td>{$vo.consignee}</td>
    <td>{$vo.tel}</td>
    <td>{$vo.create_time|date="Y-m-d H:i:s", ###}</td>
    <td>{$vo['pay_time']?date('Y-m-d H:i:s', $vo['pay_time']):'--'}</td>
    <td class="order-show-status">{$vo.orderShowStatus}</td>
    <td>
      <if condition="in_array('deliver', $vo['operates'])"><a class="btn btn-primary btn-xs" href="__CONTROLLER__/detials/id/{$vo.id}">发货</a></if>
      <if condition="in_array('check_comment', $vo['operates'])"><a class="btn btn-primary btn-xs" href="__CONTROLLER__/comment/id/{$vo.id}">审核评价</a></if>
      <if condition="in_array('act_for_sign', $vo['operates'])"><a order-id="{$vo.id}" class="btn btn-primary btn-xs act-for-sign" href="javascript:void(0);">代理签收</a></if>
      <if condition="in_array('cancel', $vo['operates'])"><a order-id="{$vo.id}" class="btn btn-primary btn-xs cancel" href="javascript:void(0);">取消订单</a></if>
      <a class="btn btn-info btn-xs" href="__CONTROLLER__/detials/id/{$vo.id}">订单详情</a>
      <a class="btn btn-danger btn-xs actionds btnRemove" order-id="{$vo.id}">移除</a>
    </td>
   </tr>
  </volist>
 </tbody>
</table>
<div class="pagination">{$pagination}</div>

<script type="text/javascript">
$(function() {
	
	$(".btnRemove").click(function() {
		if ( confirm("确定移除订单吗？") ) {
			var scope = this;
			$(this).attr('disabled', "disabled");
			$.post('__CONTROLLER__/remove', {id:$(this).attr("order-id")}, function( data ) {
				if ( data.error == 0 ) {
					$(scope).parents("tr").remove();
					alert('已移除');
				}
			});
		}
	});
	
	$(".cancel").click(function() {
		if ( confirm("确定取消订单吗？") ) {
			var scope = this;
			$(this).attr('disabled', "disabled");
			$.post('__CONTROLLER__/cancelOrder', {id:$(this).attr("order-id")}, function( data ) {
				if ( data.error == 0 ) {
					$(scope).parents("tr:eq(0)").find(".order-show-status").html("已取消");
					$(scope).remove();
					alert('已取消');
				} else {
					$(scope).removeAttr('disabled');
				}
			});
		}
	});
	
	$(".act-for-sign").click(function() {
		if ( confirm("确定把订单设置为已收货吗？") ) {
			var scope = this;
			$(this).attr('disabled', "disabled");
			$.post('__CONTROLLER__/actForSign', {id:$(this).attr("order-id")}, function( data ) {
				if ( data.error == 0 ) {
					$(scope).parents("tr:eq(0)").find(".order-show-status").html("已收货");
					$(scope).remove();
					alert('已设置为已收货');
				} else {
					$(scope).removeAttr('disabled');
					alert(data['msg']);
				}
			});
		}
	});
	
    $("#btnExportExcel").click(function() {
    	if ( $("#btn-xls-details").is(":checked") ) {
    		window.location.href = $(this).attr('data-details-url')+"?"+$('form').serialize();
    	} else {
    		window.location.href = $(this).attr('data-url')+"?"+$('form').serialize();
    	}
    });
});
</script>


<!-- daterangepicker -->
<link rel="stylesheet" type="text/css" media="all" href="__PUBLIC__/Style/Common/daterangepicker/daterangepicker-bs3.css" />
<script type="text/javascript" src="__PUBLIC__/Style/Common/daterangepicker/moment.js"></script>
<script type="text/javascript" src="__PUBLIC__/Style/Common/daterangepicker/daterangepicker.js"></script>
<script type="text/javascript">
$(document).ready(function() {

   var cb = function(start, end, label) {
        console.log(start.toISOString(), end.toISOString(), label);
        $('#reportrange span').html(start.format('YYYY/MM/DD') + ' - ' + end.format('YYYY/MM/DD'));
        $("input[name='startDate']").val(start.valueOf()/1000);
        $("input[name='endDate']").val(Math.floor(end.valueOf()/1000));
        //alert("Callback has fired: [" + start.format('MMMM D, YYYY') + " to " + end.format('MMMM D, YYYY') + ", label = " + label + "]");
   }
   
   var optionSet1 = {
            startDate: moment.unix($("input[name='startDate']").val()),
            endDate: moment.unix($("input[name='endDate']").val()),
            //minDate: '01/01/2012',
            //maxDate: '12/31/2014',
            dateLimit: { days: 60 },
            showDropdowns: true,
            showWeekNumbers: true,
            timePicker: false,
            timePickerIncrement: 1,
            timePicker12Hour: true,
            ranges: {
               '今天': [moment(), moment()],
               '昨天': [moment().subtract(1, 'days'), moment().subtract(1, 'days')],
               '7天': [moment().subtract(6, 'days'), moment()],
               '30天': [moment().subtract(29, 'days'), moment()],
               '本月': [moment().startOf('month'), moment().endOf('month')],
               '上月': [moment().subtract(1, 'month').startOf('month'), moment().subtract(1, 'month').endOf('month')]
            },
            opens: 'left',
            buttonClasses: ['btn btn-default'],
            applyClass: 'btn-small btn-primary',
            cancelClass: 'btn-small',
            format: 'YYYY/MM/DD',
            separator: ' to ',
            locale: {
                applyLabel: '确定',
                cancelLabel: '关闭',
                fromLabel: '从',
                toLabel: '到',
                customRangeLabel: '自定',
                daysOfWeek: ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr','Sa'],
                monthNames: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'],
                firstDay: 1
            }
    };
    $('#reportrange span').html(optionSet1.startDate.format('YYYY/MM/DD') + ' - ' + optionSet1.endDate.format('YYYY/MM/DD'));
    $('#reportrange').daterangepicker(optionSet1, cb);
});
</script>